﻿<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="msapplication-tap-highlight" content="no" />
    <meta http-equiv="cache-control" content="no-cache, must-revalidate">
    <title>KM招聘</title>
    <link rel="stylesheet" href="css/base.css" />
    <link rel="stylesheet" href="css/font-awesome.min.css" />
    <link rel="stylesheet" href="css/job.css" />
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/common.js"></script>
    <script type="text/javascript" src="js/layer.js"></script>
    <link href="js/DateTimePicker.css" rel="stylesheet" type="text/css" />
    <script src="js/DateTimePicker.js" type="text/javascript"></script>
    </head>
    <body style="">
    <div style="padding:21px 10px;">
        <div style="padding:21px 10px; border: 4px solid #12166e;">
        <!--<img class="bg" src="images/job/bg.png" />-->
            <div class="JobOk tipsBox">
                <img class="addJob-title" src="images/job/job-ok.png" />
            </div>
            <div class="addJob tipsBox">
                <img class="addJob-title" src="images/job/add-title.png" />
                <div class="content">
                    <ul>
                        <li>
                            <div class="lb-lt">
                                应聘岗位：
                            </div>
                            <div class="lb-lr">
                                <select id="txtJobType" class="input-ticket" placeholder="请输入应聘岗位">
                                    <option value="导购">导购</option>
                                    <option value="领班">领班</option>
                                    <option value="店长">店长</option>
                                    <option value="其他">其他</option>
                                </select>
                            </div>
                        </li>
                    </ul>
                    <ul>
                        <li>
                            <div class="lb-lt">
                                姓　　名：
                            </div>
                            <div class="lb-lr">
                                <input id="txtName" class="input-ticket" type="text" placeholder="请输入姓名" />
                            </div>
                        </li>
                    </ul>
                    <ul>
                        <li>
                            <div class="lb-lt">
                                性　　别：
                            </div>
                            <div class="lb-lr">
                                <strong>男</strong>
                                <input type="radio" checked="checked" value="0" name="Sex" />
                                <strong>女</strong>
                                <input type="radio" value="1" name="Sex" />
                            </div>
                        </li>
                    </ul>
                    <ul>
                        <li>
                            <div class="lb-lt">
                                出生年月：
                            </div>
                            <div class="lb-lr">
                                <input id="txtBirthday" data-field="date" data-format="yyyy-MM-dd" class="input-ticket"
                                    type="text" placeholder="请输入出生年月" readonly="readonly" />
                                <div id="dtBox">
                                </div>
                            </div>
                        </li>
                    </ul>
                    <ul>
                        <li>
                            <div class="lb-lt">
                                期望月薪：
                            </div>
                            <div class="lb-lr">
                                <input id="txtSalary" class="input-ticket" type="text" placeholder="请输入期望月薪" maxlength="5"/>
                            </div>
                        </li>
                    </ul>
                    <ul>
                        <li>
                            <div class="lb-lt">
                                手　　机：
                            </div>
                            <div class="lb-lr">
                                <input id="txtMobile" class="input-ticket" type="text" placeholder="请输入手机" maxlength="11"/>
                            </div>
                        </li>
                    </ul>
                    <ul>
                        <li>
                            <div class="lb-lt">
                                QQ邮箱：
                            </div>
                            <div class="lb-lr">
                                <input id="txtEmail" class="input-ticket" type="text" placeholder="请输入QQ邮箱" />
                            </div>
                        </li>
                    </ul>
                    <ul>
                        <li>
                            <div class="lb-lt">
                                工作类型：
                            </div>
                            <div class="lb-lr">
                                <select id="txtWorkType" class="input-ticket" placeholder="请输入应聘岗位">
                                    <option value="全职">全职</option>
                                    <option value="兼职">兼职</option>
                                </select>
                            </div>
                        </li>
                    </ul>
                    <ul>
                        <li>
                            <div class="lb-lt lf" style="width: 98%;">
                                <span class="lf">期望工作地点：</span>
                                <select id="Province" class="input-ticket lf" placeholder="请输入省" style="width: 40%;">
                                </select>
                                <span class="lf" style="text-indent: 0rem;">省</span>
                            </div>
                        </li>
                    </ul>
                    <ul>
                        <li>
                            <div class="lb-lt lf" style="width: 98%;">
                                <div style="padding-left: 2.5rem; width: 98%;">
                                    <select id="City" class="input-ticket lf" style="width: 35%;" placeholder="请输入市">
                                        <option></option>
                                    </select><span  class="lf" style="text-indent: 0rem;">市</span>
                                    <select id="Area" class="input-ticket lf" style="width: 35%;" placeholder="请输入区">
                                        <option></option>
                                    </select><span  class="lf" style="text-indent: 0rem;">区</span>
                                </div>
                            </div>
                        </li>
                    </ul>
                    <ul>
                        <li>
                            <div class="lb-lt lf" style="width: 98%;">
                                <div style="padding-left: 2.5rem; width: 90%;">
                                    <input id="txtAddress" class="input-ticket" type="text" placeholder="详细地址" style="width: 85%;" />
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="bottom">
                    <div class="submit-ticket ios_clickable">
                        提交申请</div>
                    <div class="txt-bt">
                        注：个人信息保密，只限于招聘使用。</div>
                </div>
            </div>
            <div style="margin-top: 1rem;">
                <img class="addJob-title" src="images/job/logo.jpg" style="width:22%;" />
            </div>
        </div>
        </div>
    </body>
    <script src="js/addressConfig.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function (e) {
            //$('.addJob').fadeIn();
            var IsSub = 0;
            //var s = layer.open({ type: 2, shadeClose: false });
            $("#dtBox").DateTimePicker();

            //初始化省份
            addressConfig.p.map(function (item) {
                $('#Province').append('<option value="' + item + '">' + item + '</option>');
                var p = $('#Province').val();
                $('#City').empty();
                addressConfig['c'][p].map(function (item) {
                    $('#City').append('<option value="' + item + '">' + item + '</option>');
                })
                var pc = $('#Province').val() + '-' + $('#City').val();
                $('#Area').empty();
                addressConfig['a'][pc].map(function (item) {
                    $('#Area').append('<option value="' + item + '">' + item + '</option>');
                })
            });
            //加载城市
            var loadCity = function (p) {
                var p = $('#Province').val();
                $('#City').empty();
                addressConfig['c'][p].map(function (item) {
                    $('#City').append('<option value="' + item + '">' + item + '</option>');
                })
            };
            //加载区/县
            var loadArea = function () {
                var pc = $('#Province').val() + '-' + $('#City').val();
                $('#Area').empty();
                addressConfig['a'][pc].map(function (item) {
                    $('#Area').append('<option value="' + item + '">' + item + '</option>');
                })
            }
            //选择省份
            $('#Province').change(function () {
                //填充城市
                loadCity();
                //填充区/县
                loadArea();
            });
            //选择城市
            $('#City').change(function () {
                //填充区/县
                loadArea();
            });

            $('.submit-ticket').click(function () {
                if (IsSub == 1) return;
                //检验提交信息
                if (Y.checkNull($('#txtName').val().trim())) {
                    layer.open({ content: '请输入姓名', skin: 'msg', time: 2 });
                    return false;
                }
                if (Y.checkNull($('#txtBirthday').val().trim())) {
                    layer.open({ content: '请输入出生年月', skin: 'msg', time: 2 });
                    return false;
                }

                if (Y.checkNull($('#txtMobile').val().trim())) {
                    layer.open({ content: '请输入手机', skin: 'msg', time: 2 });
                    return false;
                } else {
                    if (!Y.TestCellphone($('#txtMobile').val())) {
                        layer.open({ content: '手机输入有错', skin: 'msg', time: 2 });
                        return false;
                    }
                }
                if (Y.checkNull($('#Province').val().trim())) {
                    layer.open({ content: '请输入省份', skin: 'msg', time: 2 });
                    return false;
                }
                if (Y.checkNull($('#City').val().trim())) {
                    layer.open({ content: '请输入城市', skin: 'msg', time: 2 });
                    return false;
                }
                if (Y.checkNull($('#Area').val().trim())) {
                    layer.open({ content: '请输入区', skin: 'msg', time: 2 });
                    return false;
                }
                //邮箱验证
                if ($("#txtEmail").val() != "") {
                    var email = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
                    if (!email.test(($("#txtEmail").val()))) {
                        layer.open({ content: 'QQ邮箱输入有错', skin: 'msg', time: 2 });
                        return false;
                    }
                }
                //提交
                //s = layer.open({ type: 2, shadeClose: false });
                IsSub = 1;
                $.post(Y.apiUrl, {
                    action: "CreateJob",
                    JobType: $('#txtJobType').val(),
                    UserName: $('#txtName').val(),
                    Sex: $(':radio[name= Sex ]:checked').val(),
                    Birthday: $('#txtBirthday').val(),
                    Salary: $('#txtSalary').val(),
                    Mobile: $('#txtMobile').val(),
                    Province: $('#Province').val(),
                    City: $('#City').val(),
                    Area: $('#Area').val(),
                    Address: $('#txtAddress').val(),
                    Email: $('#txtEmail').val(),
                    WorkType: $('#txtWorkType').val()
                }, function (data) {
                    console.log(data);
                    //layer.close(s);
                    if (data.Success == false) {
                        layer.open({ content: data.Message, skin: 'msg', time: 2 });
                    } else {
                        IsSub = 0;
                        layer.open({ content: '申请成功！', skin: 'msg', time: 2 });
                        $('.addJob').fadeOut();
                        $('.JobOk').fadeIn();
                    }
                });
            });
        });
    </script>
</html>
